using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class admin_webparts_Plug_ins_RaoVat_Default : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string item = Request.QueryString["item"];
            string action = Request.QueryString["action"];
            string controlName = string.Empty;

            if ("post".Equals(item, StringComparison.OrdinalIgnoreCase))
            {
                if ("search".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "PostSearch.ascx";
                }
                else if ("waiting".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "PendingPostList.ascx";
                }
                else if ("approved".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "ApprovedPostList.ascx";
                }
                else if ("detail".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "PostDetail.ascx";
                }
                else if ("approve".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "PostConfirm.ascx";
                }
                else if ("deny".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "PostConfirm.ascx";
                }
                else if ("delete".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "PostDelete.ascx";
                }
            }
            else if ("bill".Equals(item, StringComparison.OrdinalIgnoreCase))
            {
                if ("search".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "BillSearch.ascx";
                }
                else if ("paid".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "BillList.ascx";
                }
                else if ("notpay".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "BillList.ascx";
                }
                else if ("inday".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "BillList.ascx";
                }
                else if ("detail".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "BillDetail.ascx";
                }
                else if ("payment".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "PaymentBill.ascx";
                }
                else if ("delete".Equals(action, StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "DeleteBill.ascx";
                }
            }

            if (controlName == string.Empty)
            {
                controlName = "PostSearch.ascx";
            }

            Control ctrl = this.LoadControl(controlName);
            this.contentCont.Controls.Add(ctrl);
        }
        catch (Exception ex) 
        {
            HtmlGenericControl ctrl = new HtmlGenericControl("div");
            ctrl.InnerHtml = "<p>" + ex.Message + "</p><p>" + ex.StackTrace + "</p>";
            this.contentCont.Controls.Add(ctrl);
        }
    }
}
